export default {

    state: {
        goods: [],
    },
    mutations: {
        addGoods(state, val) {
            var goodsInfo = { id: 0, count: 0 }
            let flag = false;
            goodsInfo.id = val,
                state.goods.some(item => {
                    if (parseInt(item.id) === parseInt(goodsInfo.id)) {
                        item.count += 1
                        flag = true
                        return true;
                    }
                })
            if (flag == false) {
                goodsInfo.count += 1;
                state.goods.push(goodsInfo)
            }
        },
        DeleteGoods(state, val) {

        }
    },
    action: {},
    getters: {},
    namespaced: true
}